#!/usr/bin/env python
#-*- coding:utf-8 -*-
import base64
import hmac
from hashlib import sha1


#        data = '{userName: "' + name +'", servicePwd: "'+ base64.encodestring(passwd) + '", cluster: {id: "' + cluster_id + '"}}'
str_base='rgdqwksgkJR6Yismp5jiNQa0Oyw='
str_ori='GET\n\n\nWed, 26 Apr 2017 07:08:22 +0000\n/'
str_ori=
# NOTE: Need to skip the Date: header, in case x-amz-date got provided
#my $httpDate = (defined $xamzHeaders{'x-amz-date'}) ? '' : POSIX::strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime);
#my $stringToSign = "$method\n$contentMD5\n$contentType\n$httpDate\n$xamzHeadersToSign$resource";
str_passwd='user1'

#print(base64.encodestring(hashlib.sha1(str_ori).digest()))
print('gj9hBQbvyIBWBbE1Pp+gsElq3Q4=')
my_sign = hmac.new(str_passwd, str_ori, sha1).digest()
#my_sign = hmac.new(str_ori, str_passwd, sha1).digest()
print (base64.encodestring(my_sign))
#print (base64.b64encode(my_sign))
#hmac.new(Token,data,hashlib.sha1).digest().encode('base64').rstrip()
#print(hmac.new('user1',str_ori,hashlib.sha1).digest().encode('base64'))
'''
print(base64.b64decode(str_base))
m = hashlib.md5()
m.update(str_ori)
print(m.hexdigest())
'''
